package com.klikmee.sms.core.commons.queues;

public interface QueueManager<T> {

	/**
	 * Enqueues new item into queue.
	 * 
	 * @param queueItem
	 *            item to be added to queue
	 * @throws InterruptedException
	 *             if item could not be added to queue
	 */
	public void enqueue(QueueItem<T> queueItem) throws EnqueueItemException;

	/**
	 * Re-enqueues item into the queue. Special re-enqueue logic can be applied here 
	 * @param item
	 * @throws InterruptedException 
	 */
	public void requeue(QueueItem<T> item) throws EnqueueItemException;
	/**
	 * Starts queue manager
	 */
	public void start();

	/**
	 * Stops queue manager
	 */
	public void stop();
	
	/**
	 * Set's item processor to be used with this manager
	 * @param itemProcessor instance of item processor
	 */
	public void setItemProcessor(QueueItemProcessor<T> itemProcessor);

}